package com.nulldev.util.uri.iwebkit.legacy.element;

import java.awt.Font;
import java.awt.Graphics2D;

import javax.swing.JLabel;

public abstract class Element {

	protected final Font default_font = new JLabel().getFont();
	private String html_id;
	private String html_class;
	private String html;
	private String css;
	private String data;
	private ElementType type;

	public Element(final String id, final String classID, final String html, final String css, final String data, final ElementType type) {
		this.html_id = id;
		this.html_class = classID;
		this.html = html;
		this.css = css;
		this.data = data;
		this.type = type;
	}

	public abstract void onLoad();
	public abstract void onRender(final Graphics2D g2d, final int x, final int y, final int width);

	public String getData() {
		return this.data;
	}

	public String getID() {
		return this.html_id;
	}

	public String getHTMLClass() {
		return this.html_class;
	}

	public String getHTML() {
		return this.html;
	}

	public String getCSS() {
		return this.css;
	}

	public ElementType getType() {
		return this.type;
	}

	private int width = 0, height = 0;

	public int width() {
		return this.width;
	}

	public int height() {
		return this.height;
	}

	public void updateHeight(final int newHeight) {
		this.height = newHeight;
	}

	public void updateWidth(final int newWidth) {
		this.width = newWidth;
	}
}
